package com.xiyue.leaspring;

import java.util.Arrays;
import java.util.List;

import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;

public class SpELFirstDemo20 {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		String str = "{'xiyue','asdas','下属','下手'}";//定义表达式
		ExpressionParser parser = new SpelExpressionParser();
		Expression exp = parser.parseExpression(str);
		EvaluationContext context = new StandardEvaluationContext();
		List<String> result = exp.getValue(context,List.class);//获取集合
		String[] resulta = exp.getValue(context,String[].class);//获取集合
		System.out.println(result);
		System.out.println(Arrays.toString(resulta));
	}

}
